
local mt = ac.skill['蛇毒']

function mt:on_add()
    local hero = self.owner
    self:gc(hero:event '单位-攻击命中'(function(_,_,target)
        target:add_buff '蛇毒'{
            source = hero,
        }
    end))
end

local buff = ac.buff['蛇毒']
buff.model1 = [[Abilities\Weapons\PoisonSting\PoisonStingTarget.mdl]]
buff.time = 3
buff.pulse = 1
buff.art = [[ReplaceableTextures\PassiveButtons\PASBTNEnvenomedSpear.blp]]
buff.tip = [[你中毒了]]

function buff:on_cover(new)
    self:set_remaining(new.time)
    return false
end

function buff:on_add()
    local hero = self.owner
    self:gc(hero:add_effect(self.model1))
end

function buff:on_pulse()
    local source = self.source
    local target = self.target
    local damage = source:get('攻击') * 0.5
    source:create_damage(target,damage,self)
end